{extend name="../../admin/view/main"}

{block name="button"}
<!--{if auth("add")}-->
<button data-modal="{:url('add')}" data-title="添加用户级别" class='layui-btn layui-btn-sm layui-btn-primary'>添加用户级别</button>
<!--{/if}-->

<!--{if auth("sync")}-->
<button data-queue="{:url('sync')}" data-confirm="确定要刷新所有用户的统计数据吗？" class='layui-btn layui-btn-sm layui-btn-primary'>刷新用户数据</button>
<!--{/if}-->
{/block}

{block name='content'}
<div class="layui-badge think-bg-red padding-5 padding-left-10 font-s15 layui-anim layui-anim-upbit">
    注意，用户级别配置不能随意修改或删除，会影响系统结算与用户升级！
</div>
<div class="think-box-shadow">
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'/></label>
            </th>
            <th class="text-left nowrap">用户级别</th>
            <th class="text-left nowrap">升级规则</th>
            <th class="text-center nowrap">入会礼包</th>
            <th class="text-center nowrap">团队总数</th>
            <th class="text-center nowrap">直属团队</th>
            <th class="text-center nowrap">间接团队</th>
            <th class="text-center nowrap">订单金额</th>
            <th class="text-left nowrap">奖利规则</th>
            <th class="text-left nowrap">使用状态</th>
            <th></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr>
            <td class='list-table-check-td think-checkbox'>
                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'/></label>
            </td>
            <td class="text-left nowrap"> [ <span class="color-blue">{$vo.number}</span> ] {$vo.name|default=''}</td>
            <td class="text-left nowrap">{if $vo.upgrade_type eq 1}<span class="color-green">全部完成</span>{else}<span class="color-blue">任何条件</span>{/if}</td>
            <td class="text-center nowrap">{if $vo.goods_vip_status>0}<b class="layui-icon layui-icon-ok-circle color-green"></b> {else} - {/if}</td>
            <td class="text-center nowrap">{if $vo.teams_user_status>0} <b class="color-green">{$vo.teams_user_number}</b> 人 {else} - {/if}</td>
            <td class="text-center nowrap">{if $vo.teams_direct_status>0} <b class="color-green">{$vo.teams_direct_number}</b> 人 {else} - {/if}</td>
            <td class="text-center nowrap">{if $vo.teams_indirect_status>0} <b class="color-green">{$vo.teams_indirect_number}</b> 人 {else} - {/if}</td>
            <td class="text-center nowrap">{if $vo.order_amount_status>0} <b class="color-green">{$vo.order_amount_number+0}</b> 元 {else} - {/if}</td>
            <td class="text-left">{:join(', ',$vo.rebate_rule)}</td>
            <td class='text-left nowrap'>
                {if $vo.status eq 0}<span class="color-red">已禁用</span>{elseif $vo.status eq 1}<span class="color-green">使用中</span>{/if}
            </td>
            <td class='text-left nowrap'>
                <!--{if auth("edit")}-->
                <a class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}' data-title="编辑用户级别">编 辑</a>
                <!--{/if}-->

                <!--{if auth("state") and $vo.status eq 1}-->
                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('state')}" data-value="id#{$vo.id};status#0" data-csrf="{:systoken('state')}">禁 用</a>
                <!--{elseif auth("state") and $vo.status eq 0}-->
                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('state')}" data-value="id#{$vo.id};status#1" data-csrf="{:systoken('state')}">启 用</a>
                <!--{/if}-->

                <!--{if auth("remove")}-->
                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除用户级别吗？" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删 除</a>
                <!--{/if}-->
            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
</div>
{/block}